package com.ids.idtma.setting;

import com.ids.idtma.ActivityBase;
import com.ids.idtma.IdtApplication;
import com.ids.idtma.R;
import com.ids.idtma.map.IdtMap;
import com.ids.idtma.util.CommonUtils;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class DebugSettingActivity extends ActivityBase implements OnClickListener ,OnItemClickListener{

	private ListView debug_setting_listview;
	private ArrayAdapter<String> arrayAdapter;


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_debug_setting);
		IdtApplication.getInstance().addActivity(this);
		initView();
		initData();
//				PORT=9800       调试端口
//				LEVEL=3         输出级别
//				LOG=1           是否记录日志
//				SAVEFRAME=1     是否记录媒体帧
//				TRANSDEBUG=0    是否打印传输信息
	}
	
		
	private void initData() {
		arrayAdapter = new ArrayAdapter<String>(DebugSettingActivity.this,
				R.layout.idt_setting_listview_item);
		arrayAdapter.add("调试端口设置");
		arrayAdapter.add("输出级别设置");
		arrayAdapter.add("是否记录日志");
		arrayAdapter.add("媒体帧记录开关");
		arrayAdapter.add("传输信息打印开关");
		debug_setting_listview.setAdapter(arrayAdapter);
		debug_setting_listview.setOnItemClickListener(this);
	}


	private void initView() {
		debug_setting_listview = (ListView) findViewById(R.id.debug_setting_listview);
		 ((TextView) findViewById(R.id.page_title_name)).setText("调试信息设置");
		 
	}


	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.map:
			// 点击地图图标
			CommonUtils netStatus = new CommonUtils();
			if (netStatus.isConnectingToInternet(DebugSettingActivity.this)) {
				Toast.makeText(DebugSettingActivity.this, "进入地图", Toast.LENGTH_SHORT)
						.show();
				Intent intent = new Intent(DebugSettingActivity.this, IdtMap.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(intent);
				break;
			} else {
				Toast.makeText(DebugSettingActivity.this, "当前无网络进入地图", Toast.LENGTH_SHORT)
						.show();
				Intent intent = new Intent(DebugSettingActivity.this, IdtMap.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(intent);
				break;
			}
		case R.id.return_button:
			IdtApplication.getInstance().deleteActivity(this);
		default:
			break;
		}
	}


	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		if(arrayAdapter.getItem(arg2).equals("调试端口设置")){
			
		}else if (arrayAdapter.getItem(arg2).equals("输出级别设置")){
			
		}else if (arrayAdapter.getItem(arg2).equals("是否记录日志")){
			
		}else if (arrayAdapter.getItem(arg2).equals("媒体帧记录开关")){
			
		}else if (arrayAdapter.getItem(arg2).equals("输出级别设置")){
	
		}else if (arrayAdapter.getItem(arg2).equals("传输信息打印开关")){
	
}
		
	}

}
